import {Component, OnInit} from '@angular/core';
import {UserService} from "../user/user.service";
import {Router} from "@angular/router";

@Component({
  selector: 'app-login',
  templateUrl: './register.component.html',
  styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {

  constructor(
    private userService: UserService,
    private router: Router
  ) {
  }

  ngOnInit(): void {
  }

  nickName = ""
  phoneNum = ""
  password = ""
  confirmPW = ""

  register() {
    let loginInfo = {
      nickName: this.nickName,
      phoneNum: this.phoneNum,
      password: this.password,
      confirmPW: this.confirmPW
    }
    this.userService
      .register(loginInfo)
      .subscribe(data => {
        this.alertFunc(data
      )} )
  }

  alertFunc(data:any){
    console.log(data)
    alert(data.msg)
  }
}
